from string import *

class Anagram():
    def __init__(self, string):
        self.s = string
        self.lw = split(string)

    def sign(self, word):
        """Making signature"""
        word_list = []
        signature = []
        for i in range(0,len(self.lw)):
            char_list = list(word)
            char_list.sort()
            word_list.append([])
            for char in char_list:
                if not char in word_list:
                    word_list[i].extend([char, str(self.s.count(char))])
                else:
                    continue
            signature.append(''.join(word_list[i]))
        
        return signature
    
    def anagramCollect(self):
        """Collect anagrams signatures into dictionary"""
        ana_dict = {}
        for word in self.lw:
            word = word.rstrip()
            signature = self.sign(word)
            ana_dict.setdefault(signature[0],[]).append(word)
                    
        return ana_dict
    
                
    def printAnagram(self, ana_dict):
        """Print anagrams"""
        ana_list = ana_dict.values()
        for value in ana_list:
                if len(value) > 1:
                        print ' '.join(value)
                else:
                        print ''.join(value), "No anagram for that!"      
        
           
l = 1

while l:
    s = raw_input("Enter string: \n")
    if len(s)>255 and len(s) == 0:
        l=1
    else:
        l=0
  
st = Anagram(s)
 
anagram = st.anagramCollect()

st.printAnagram(anagram)     

